<template>
    <!-- <el-row >
                <el-col :sapn="6">
                    <el-input v-model="id" placeholder="请输入id查询"></el-input>
                </el-col>
                <el-col :sapn="6">
                    <el-button type="primary">查询</el-button>
                    <el-button type="primary">重置</el-button>
                </el-col>
            </el-row>
            <el-table :data="tableData" style="width: 100%">
                <el-table-column prop="date" label="日期" width="180">
                </el-table-column>
                <el-table-column prop="name" label="姓名" width="180">
                </el-table-column>
                <el-table-column prop="address" label="地址">
                </el-table-column>
            </el-table> -->
    <!-- eslint-disable vue/multi-word-component-names -->
    <div>
        <div class="search">
            <el-form ref="form" :model="form" label-width="80px">
                <el-row>
                    <el-col :span="4">
                        <el-form-item label="客户姓名">
                            <el-input size="small" v-model="form.name"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="客户手机">
                            <el-input size="small" v-model="form.name"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="归属人">
                            <el-input size="mini" v-model="form.name"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="渠道来源">
                            <el-select size="small" v-model="value" placeholder="请选择">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="4">
                        <el-form-item label="线索状态">
                            <el-select size="small" v-model="value" placeholder="请选择">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="跟进时间">
                            <el-date-picker v-model="value1" type="datetimerange" range-separator="至"
                                start-placeholder="开始日期" end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item>
                            <el-button type="primary">搜索</el-button>
                            <el-button>重置</el-button>
                        </el-form-item>

                    </el-col>
                </el-row>

            </el-form>
        </div>
        <div class="table">
            <el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="clueId" label="线索编号" width="80">
            </el-table-column>
            <el-table-column prop="name" label="客户姓名" width="80">
            </el-table-column>
            <el-table-column prop="phone" label="手机号码">
            </el-table-column>
            <el-table-column prop="channelName" label="渠道来源">
            </el-table-column>
            <el-table-column prop="createTime" label="创建时间 " show-overflow-tooltip width="180">
            </el-table-column>
            <el-table-column prop="owner" label="线索归属">
            </el-table-column>
            <el-table-column prop="status" label="线索状态">
                <template v-slot="scope">
                    <!-- scope.row 当前行的信息 -->
                    <!-- {{ scope.row }} -->
                    <el-tag v-if="scope.row.status == 1">已分配</el-tag>
                    <el-tag type="success" v-if="scope.row.status == 2">跟进中</el-tag>
                    <el-tag type="info" v-if="scope.row.status == 0">未知</el-tag>
                    <el-tag type="warning" v-if="scope.row.status == 4">伪线索</el-tag>
                    <el-tag type="danger" v-if="scope.row.status == 3">回收</el-tag>
                </template>
            </el-table-column>
            <el-table-column prop="nextTime" label="下次跟进时间" width="180">
            </el-table-column>
            <el-table-column prop="address" label="操作" width="150">
                <template>
                    <el-button size="mini">修改</el-button>
                    <el-button type="dangger" size="mini">删除</el-button>
                </template>
            </el-table-column>
            </el-table>
            <!-- current-page当前页码 -->
            <el-pagination background style="margin-top: 10px;" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="query.pageNum" :page-sizes="[10, 20, 30, 40]" :page-size="10"
                layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>

        </div>
    </div>
</template>

<script>
import { clueList } from '@/api/clue';
export default {
    data() {

        return {
            id: null,
            tableData: [],
            form: {

            },
            options: [{
                value: '选项1',
                label: '黄金糕'
            }, {
                value: '选项2',
                label: '双皮奶'
            }, {
                value: '选项3',
                label: '蚵仔煎'
            }, {
                value: '选项4',
                label: '龙须面'
            }, {
                value: '选项5',
                label: '北京烤鸭'
            }],
            value: '',
            value1: '',
            query: {
                pageNum: 1,
                pageSize: 10
            },
            total:0
        }
    },
    created() {
        this.getList()
    },
    methods: {
        getList() {
            clueList(this.query).then(res => {
                console.log(res)
                this.tableData = res.rows
                this.total = res.total
            })

        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
            this.query.pageSize = val
            this.query.pageNum = 1
            this.getList()
        },
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
            this.query.pageNum = val
            // 重新调用接口
            this.getList()
        }
    },
}
</script>



<style lang="scss" scoped></style>
